#include <stdio.h>

#include <unistd.h>
#include <sched.h>
 #include <sys/syscall.h>

#define SCHED_MYDIY 7


int main(int argc, char *argv[])
{
	int ret;
	struct sched_param sp = { .sched_priority = 50 };

	printf("PID=%d, SCHED_OTHER=%d, SCHED_FIFO=%d\n",
		getpid(), SCHED_OTHER, SCHED_FIFO);

	syscall(700, 1);

	ret = sched_setscheduler(0, SCHED_MYDIY, &sp);
	if (ret < 0) {
		printf("sched_setscheduler SCHED_MYDIY failed, ret=%d\n", ret);
		goto out;
	}
	printf("Scheduler ID: %d\n", sched_getscheduler(0));

	ret = sched_setscheduler(0, SCHED_FIFO, &sp);
	if (ret < 0) {
		printf("sched_setscheduler SCHED_FIFO failed, ret=%d\n", ret);
		goto out;
	}
	printf("Scheduler ID: %d\n", sched_getscheduler(0));



out:
	syscall(700, 0);

	// while (1) {
	// 	//sleep(1);
	// 	//printf("Hello...(scheduler:%d)\n", sched_getscheduler(0));
	// }

	return 0;
}
